package com.ticket.sass.common.entity.tenant;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("shop_goods_stocks")
public class ShopGoodsStockEntity {
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private Long goodsId;
    private Long quantity;
    private Long cinemaId;
    private Long tenantId;
    private Long version;
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    public boolean isStockSufficient(Long quantity) {
        return this.quantity >= quantity;
    }
}
